import { LOGIN, ROUTES } from '@/services/api';
import {request, METHOD, removeAuthorization} from '@/utils/request'

/**
 * 登录服务
 * @returns {Promise<AxiosResponse<T>>}
 * @param params
 */

//  登录
export async function login(params) {
  return request(LOGIN, METHOD.POST,params )
}

//  验证登录
export async function getRoutesConfig() {
  return request(ROUTES, METHOD.GET)
}

//  退出登录
export function logout() {
  localStorage.removeItem(process.env.VUE_APP_ROUTES_KEY)
  localStorage.removeItem(process.env.VUE_APP_PERMISSIONS_KEY)
  localStorage.removeItem(process.env.VUE_APP_ROLES_KEY)
  removeAuthorization()
}

/*
 *  VR列表验证
 *
 */


export default {
  login,
  logout,
}
